package coroutines.coroutine.runblocking

import kotlinx.coroutines.*

class runBlockingLaunchTest {
}

fun main() {
    var runBlockingJob: CoroutineScope? = null
    runBlocking {
        runBlockingJob = this@runBlocking

        println("runBlocking start1")

        launch {
            delay(100)
            println("launch1 completed, runBlocking.isActive = ${this@runBlocking.isActive}")
        }

        launch {
            delay(200)
            println("launch2 completed, runBlocking.isActive = ${this@runBlocking.isActive}")
        }

        launch {
            delay(300)
            println("launch3 completed, runBlocking.isActive = ${this@runBlocking.isActive}")
        }

        delay(150)

        println("runBlocking start2, runBlockingJob.isActive = ${runBlockingJob?.isActive }}")
    }

    println("Main thread completed runBlockingJob.isActive = ${runBlockingJob?.isActive }}")
}